'use strict';

const Controller = require('egg').Controller;

class ToolController extends Controller {

    async holidayList(){
        const { ctx } = this;
        let params = ctx.request.body;

        let list = await ctx.service.tool.getHolidayList((new Date(params.start)).getTime(), (new Date(params.end)).getTime());

        ctx.body = JSON.stringify(list);
    }

    async holidayInit(){
        const { ctx } = this;
        let params = ctx.request.query;

        let list = await ctx.service.tool.initDbHoliday((new Date("2022-08-01")).getTime(), (new Date("2022-12-30")).getTime());

        ctx.body = "ok";
    }
}

module.exports = ToolController;
